<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>导航管理</title>
    <link rel="stylesheet" href="<?php echo _APP_URL_;?>/library/layui/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="<?php echo _APP_URL_;?>/library/layui/module/admin.css?v=315" media="all"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<!-- 加载动画 -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>

<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">

            <div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label w-auto">搜索：</label>
                        <div class="layui-input-inline mr0">
                            <input name="keyword" class="layui-input" type="text" placeholder="输入关键字"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn icon-btn" lay-filter="formSubSearchTbBas" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        <a href="<?php echo url(['cms','admin/nav','nav_edit']);?>">
                        <button id="btnExportTbBas" class="layui-btn icon-btn">
                            <i class="layui-icon">&#xe67d;</i>添加
                        </button>
                        </a>
                    </div>
                </div>
            </div>

            <table class="layui-table" id="tableTbBas" lay-filter="tableTbBas">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>名称</th>
                        <th>图片</th>
                        <th>简介</th>
                        <th>位置</th>
                        <th>显示方式</th>
                        <th>排序</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr> 
                </thead>
                <tbody>
                    <?php
                    foreach($rs as $row){
                    ?>
                    <tr>
                        <td ><?php echo $row['id'];?></td>
                        <td ><?php echo $row['name'];?></td>
                        <td ><?php echo $row['pic_url'];?></td>
                        <td ><?php echo $row['tip'];?></td>
                        <td ><?php echo $row['place'];?></td>
                        <td ><?php echo $row['view_type'];?></td>
                        <td ><?php echo $row['display_order'];?></td>
                        <td ><?php echo $row['status'];?></td>
                        <td >
                        
                            <button class="layui-btn layui-btn-primary">编辑</button>
                            <button class="layui-btn layui-btn-danger">删除</button>
                        </td>
                    </tr>
                    <?php
                    }
                    ?>
                </tbody>
            </table>
            <div style="text-align:center;margin-top:10px">
            
            </div>
        </div>
    </div>
</div>

<!-- 表格操作列 -->
<script type="text/html" id="tableBarTbBas">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    <a class="layui-btn layui-btn-xs" data-dropdown="#dropUser{{d.LAY_INDEX}}" no-shade="true">
        更多<i class="layui-icon layui-icon-drop" style="font-size: 12px;margin-right: 0;"></i></a>
    <!-- 下拉菜单 -->
    <ul class="dropdown-menu-nav dropdown-bottom-right layui-hide" id="dropUser{{d.LAY_INDEX}}">
        <div class="dropdown-anchor"></div>
        <li><a lay-event="edit2"><i class="layui-icon layui-icon-edit"></i>修改用户</a></li>
        <li><a lay-event="del2"><i class="layui-icon layui-icon-delete"></i>删除用户</a></li>
        <li><a lay-event="print2"><i class="layui-icon layui-icon-print"></i>打印用户</a></li>
    </ul>
</script>
<!-- js部分 -->
<script type="text/javascript" src="<?php echo _APP_URL_;?>/library/layui/libs/layui/layui.js"></script>
<script type="text/javascript" src="<?php echo _APP_URL_;?>/library/layui/js/common.js?v=315"></script>
<script>
    layui.use(['layer', 'form', 'table', 'util', 'dropdown'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var dropdown = layui.dropdown;

        //监听工具条
        table.on('tool(tableTbBas)', function (obj) {
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值

            if (layEvent === 'edit') { // 查看
                layer.msg('点击了修改');
            } else if (layEvent === 'del') { // 删除
                layer.msg('点击了删除');
            } else if (layEvent === 'edit2') { // 修改2
                layer.msg('点击了下拉菜单修改');
            } else if (layEvent === 'del2') { // 删除2
                layer.msg('点击了下拉菜单删除');
            } else if (layEvent === 'print2') { // 打印2
                layer.msg('点击了下拉菜单打印');
            }
            dropdown.hideAll();
        });

        // 搜索按钮点击事件
        form.on('submit(formSubSearchTbBas)', function (data) {
            insTb.reload({where: data.field}, 'data');
        });

    });
</script>
</body>

</html>